<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="ibox-content">
    <form class="form-horizontal" method="post" action="#">
		<input type="hidden" name="supplier_id" value="#{$one.supplier_id}#">
      <div class="form-group">
        <label class="col-sm-2 control-label">供应商名称</label>
        <div class="col-sm-10">
          <input name="name" class="form-control" type="text" value="#{$one.name}#" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">经济类型</label>
        <div class="col-sm-10">
          <select data-placeholder="选择经济类型..." name="ecotype" class="chosen-select ecotype-chosen-select" style="width: 200px;" tabindex="2">      
					  #{foreach from=$ecotype key=k item=v}#	  
            <option value="#{$v.dict_id}#" hassubinfo="true">#{$v.name}#</option>
					  #{/foreach}#
          </select>
        </div>
      </div>
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">行业类型</label>
        <div class="col-sm-8">
          <select data-placeholder="选择行业类型..." name="trade" class="chosen-select trade-chosen-select" style="width: 200px;" tabindex="2">
					  #{foreach from=$trade key=k item=v}#	  
            <option value="#{$v.dict_id}#" hassubinfo="true">#{$v.name}#</option>
					  #{/foreach}#
          
          </select>
        </div>
      </div>
 		<div class="form-group">
        <label class="col-sm-2 control-label">联系人</label>
        <div class="col-sm-10">
          <input name="linkman" class="form-control" type="text" value="#{$one.linkman}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">电话</label>
        <div class="col-sm-10">
          <input name="tel" class="form-control" type="text" value="#{$one.tel}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">传真</label>
        <div class="col-sm-10">
          <input name="fax" class="form-control" type="text" value="#{$one.fax}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">邮箱</label>
        <div class="col-sm-10">
          <input name="email" class="form-control" type="text" value="#{$one.email}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">地址</label>
        <div class="col-sm-10">
          <input name="address" class="form-control" type="text" value="#{$one.address}#"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">介绍</label>
        <div class="col-sm-10">
          <textarea name="intro" class="form-control">#{$one.inro}#</textarea>
        </div>
      </div>
		#{$field_ext}#
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
          <button class="btn btn-w-m btn-info save-form" type="button">保存数据</button>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 自定义js --> 
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
<script>
$(document).ready(function () {
	
	//下拉选择+联动效果
	$('.chosen-select').chosen({search_contains: true});
	$(".ecotype-chosen-select").val("#{$one.ecotype}#").trigger("chosen:updated");
	$(".trade-chosen-select").val("#{$one.trade}#").trigger("chosen:updated");
	//扩展字段+联动
  #{foreach from=$options key=k item=v}#	
	$(".#{$k}#-chosen-select").val("#{$v}#").trigger("chosen:updated");
  #{/foreach}#
	//数据保存
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/erp/SupSupplier/sup_supplier_modify/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.statusCode=='200'){
					layer.msg('操作成功', {icon: 1}); 		
				}
			},    
			complete: function() {   
				setTimeout(function(){
					//关闭窗口
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);
				 },800);
   		  },
		});		
	});
});
</script>
</body>
</html>